import http from "../utils/request.js"

// 获取验证码
export let getcaptchaApi = () => http.get("/users/getCaptcha?v=next")

// 校验验证码
export let verifycaptchaApi = captcha => http.get("/users/verifyCaptcha?captcha=" + captcha)

// 用户名密码登录
export let LoginApi = (username, password) => http.post("/users/login", {
    username,
    password
})


// 获取手机验证码
export let getSmsCode = phoneNumber => http.post("/sms/send", { phoneNumber })

// 手机验证码登录
export let smsLoginApi = code => http.post("/users/login?type=sms", { code })


// 添加角色(仅有root权限)
export let addLoginApi = (roleid, token) => http.post("/permission/addrole", {
    roleid,
    token
})

// 获取角色列表
export let getRoleApi = (token) => http.get("/permission/getrole")

// 获取权限菜单
export let powerApi = () => http.get("/permission/getMenuList")

// 获取登录日志
export let getLog = (page, count) => http.get("/getloginlog", {
    params: {
        page,
        count
    }
})